{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}

{% block breadcrumbs %}
  <li><a href="{% url 'ipam:role_list' %}">Roles</a></li>
  <li>{{ object }}</li>
{% endblock %}

{% block content %}
<div class="row">
	<div class="col-md-6">
    <div class="panel panel-default">
      <div class="panel-heading">
        <strong>Role</strong>
      </div>
      <table class="table table-hover panel-body attr-table">
        <tr>
          <td>Name</td>
          <td>{{ object.name }}</td>
        </tr>
        <tr>
          <td>Description</td>
          <td>{{ object.description|placeholder }}</td>
        </tr>
        <tr>
          <td>Weight</td>
          <td>{{ object.weight }}</td>
        </tr>
        <tr>
          <td>Prefixes</td>
          <td>
            <a href="{% url 'ipam:prefix_list' %}?role_id={{ object.pk }}">{{ prefixes_table.rows|length }}</a>
          </td>
        </tr>
      </table>
    </div>
    {% plugin_left_page object %}
	</div>
	<div class="col-md-6">
    {% include 'inc/custom_fields_panel.html' %}
    {% plugin_right_page object %}
  </div>
</div>
<div class="row">
	<div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
        <strong>Prefixes</strong>
      </div>
      {% include 'inc/table.html' with table=prefixes_table %}
      {% if perms.ipam.add_prefix %}
        <div class="panel-footer text-right noprint">
          <a href="{% url 'ipam:prefix_add' %}?role={{ object.pk }}" class="btn btn-xs btn-primary">
            <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add prefix
          </a>
        </div>
      {% endif %}
    </div>
    {% include 'inc/paginator.html' with paginator=prefixes_table.paginator page=prefixes_table.page %}
    {% plugin_full_width_page object %}
  </div>
</div>
{% endblock %}
